package com.example.rpc.sample.client;

import com.example.rpc.client.RpcProxy;
import com.example.rpc.sample.api.HelloService;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Author Anita
 * @Date 2017/12/25 19:08
 */
public class HelloClient {
    public static void main(String[] args) throws Exception{
        ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
        RpcProxy rpcProxy = context.getBean(RpcProxy.class);
        HelloService helloService = rpcProxy.create(HelloService.class);
        String result = helloService.hello("World");
        System.out.println(result);
        HelloService helloService2 = rpcProxy.create(HelloService.class,"sample.hello2");
        String result2 =helloService2.hello("世界");
        System.out.println(result2);
        System.exit(0);
    }
}
